

(function() {
  window.onload = function() {
	  
	// Creating a reference to the mapDiv
    var mapDiv = document.getElementById('map');
    
    // Creating a latLng for the center of the map
    var latlng = new google.maps.LatLng(40.7257, -74.0047);
    
    // Creating an object literal containing the properties 
    // we want to pass to the map  
    var options = {
      center: latlng,
      zoom: 12,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    
    // Creating the map
    var map = new google.maps.Map(mapDiv, options);
    
    //add a marker
    var marker = new google.maps.Marker({
    	position: new google.maps.LatLng(40.7257, -74.0047),
    	map: map,
    	title: 'Sample Tooltip'
    });
    
    //add infowindow
    var infowindow = new google.maps.InfoWindow({
    	content: 'Hello World'
    });
    
    //add eventlistener to the marker
    google.maps.event.addListener(marker, 'click', function(){
    	infowindow.open(map,marker);
    });
    
  };
  
  
  
})();
